<!DOCTYPE html>
<html>
<#include "../head.html">
    <body>
    <table class="mc">
        <tr>
            <td class="mc-l">
                <!--左侧导航---{-->
                <div id="navPanelContainer">
                    <div class="system-logo cd"></div>
                    <!--管理员信息---{-->
                    <#include "../adminInfo.html">
                        <!--管理员信息---}-->
                        <div class="nav-wrap">
                            <#include "left.html">
                        </div>
                </div>
                <!--左侧导航---}-->
            </td>
            <td class="mc-m">
                <div class="navToggle"></div>
            </td>
            <td class="mc-r">
                <!--顶部导航---{-->
                <#include "../topNav.html">
                    <!--顶部导航---}-->
					<#assign fd="FINANCE_DIRECTOR">
                    <!--面包屑导航---{-->
                    <#if regFlag =1>
                    	<#assign moduleName="在网客户">
                    <#else>
                        <#assign moduleName="意向用户">
                    </#if>
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix">
                                     
                               <#if fd  == auth_user.userType.code>                       
				                     <div class="v" style="float:left; margin-top: 15px; margin-left:22px;">
				                    	 理财经理：
				                       <select id="fmId" name="fmId" style="min-width:124px; color:#000; height:26px;" class="search-value">
				                        <#if fdList??>
											<#list fdList as item>
												<#if item??>
													 <option value="${item.userId}" >${item.realname!''}</option>
												</#if>
											</#list>
										</#if>
				                        </select>
	                                 </div>
	                                 <div class="toolbor-module search"  style="float:left;">
	                                    <a id="batchchange" href="javascript:void(0);" class="input-button">批量更改</a>
	                                </div>
	                            </#if>
                            
			                    <#if regFlag =0>
	                                <div class="toolbor-module search">
	                                    <a href="addCustomer.html" class="input-button">+新增客户</a>
	                                </div>
			                    </#if>

                                <div class="toolbor-module search">
                                
                                 <#if fd  == auth_user.userType.code>  
                                    <div class="formTit">理财经理：</div>
                                    <input type="text" name="fmName" id="fmName" class="search-value">
                                 </#if>  
                                                                     
                                    <div class="formTit">开始日期：</div><input id="startDate" type="text" name="startDate" style="width:125px;padding:0 10px;height:18px;line-height:18px;float:left" onclick="change_picktime('yyyy-MM-dd')" readonly/>
						           	<div class="formTit">结束日期：</div><input id="endDate" type="text" name="endDate" style="width:125px;height:18px;line-height:18px;float:left" onclick="change_picktime('yyyy-MM-dd')" readonly/>
                                 
                                	<div class="formTit">姓名 /身份证/手机：</div>
                                    <input type="text" name="searchName" id="searchName" class="search-value">
                                    <input type="button" value="搜索"  class="input-button" onclick="sousuo();">
                                </div>
                            </div>
                            

                            <!--工具栏--}-->

                            <div id="main" class="clearfix">
                                <form id="batchForm" action="/admin/crm/batchChange.html" method="post">
                                    <table class="data-list">
                                        <tr class="header">
                                        	<#if fd  == auth_user.userType.code> <td><input type="checkbox" id="chk_all"/></td></#if>
                                       		<td>客户ID</td>
                                       		<#if regFlag =1>
                                       			<td>用户名</td>
                                       		</#if>
                                       		<td>姓名</td>
                                       		<td>手机</td>
                                            <td>性别</td>
                                            <td>出生日期</td>
                                            <td>身份证号码</td>
                                            <td>客户邮箱</td>
                                            <td>通讯地址</td>
                                            <td>创建时间</td>   
                                            <td>理财经理</td>  
                                            <td>备注</td> 
                                             <td>操作</td>                                 
                                        </tr>
                                     <#list list as item>
                                            <tr class="s">
                                            	<#if fd  == auth_user.userType.code> <td><input type="checkbox" value="${item.id?c}"  name="custIds"/></td></#if>
                                                <td>${item.id!0}</td>
                                                <#if regFlag =1>
                                       				<td>${item.userName!''}</td>
                                       			</#if>
                                                <td>${item.custName!''}</td>
                                                 <td>${item.phone!''}</td>
                                                <td><#if item.gender==0>保密<#elseif item.gender==1>男<#else>女</#if></td>
                                                <td><#if item.birthday??>${(item.birthday)?string('yyyy-MM-dd')}<#else></#if></td>
                                                <td>${item.identityNumber!''}</td>
                                                <td>${item.email!''}</td>
                                                <td>${item.addr!''}</td>
                                                <td>${(item.createDate)?string("yyyy-MM-dd HH:mm:ss")}</td>
                                                <td>${item.systemUser.realname!''}</td>
                                                <td>${item.memo!''}</td>
                                                <td>    
                                                 <#if fd  == auth_user.userType.code> 
                                                	<a class="un" href="/admin/crm/modifyCustomer.html?id=${item.id!0}&page=${page.currentPage}&searchName=${searchName}">修改</a>
                                                </#if>
                                                
                                               <a class="un" href="/admin/crm/addTrackRecord.html?custId=${item.id!0}&custName=${item.custName!''}&page=${page.currentPage}&searchName=${searchName}">跟踪</a>
                   
                   								<#if item.user ??>
                   								<#else>
                   								   <a class="un" href="/admin/crm/synCustomer.html?custId=${item.id!0}&page=${page.currentPage}&searchName=${searchName}">同步</a>
                   								</#if>
                   								
                   
                                                </td>
                                            </tr>
                                        </#list>
                                    </table>
                                    <input  type="hidden" id="custfmId" name ="fmId">
                                    <input  type="hidden" id="regFlag" name ="regFlag" value='${regFlag}'>
                                </form>


                                <!--底部工具栏--{-->
                                <div id="bottomToolbar" class="clearfix">
                                    <div class="other-tool">
                                        <dl class="refresh-data">
                                            <dt class="refresh-data-icon"></dt>
                                            <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                        </dl>
                                    </div>
                                 <!--翻页系统--{-->
                                    <div class="container s_formPage">
                                        <#import "../../common/page.html" as pager>
                                            <@pager.pagination page=page url="${pageUrl}" map=param style="style1" />
                                    </div>
                                    <!--翻页系统--}-->
                                </div>
                                <!--底部工具栏--}-->
                                
                                
                                <script>
                                    var url = 'queryCustomer.html?search=true&regFlag=${regFlag}';

                                    function sousuo(){
                                        var sou = "";
                                        var ofp = $("#searchName").val();
                                        var fmn = $("#fmName").val();
                                        
                                        var startDate = $("#startDate").val();
                                        var endDate = $("#endDate").val();

                                        if((ofp!=null&&ofp!=""&&ofp!="undefined"&&ofp!="请输入(姓名 /身份证/手机)关键字")){
                                        	sou += "&searchName="+ofp;
                                        }
                                        if((fmn!=null&&fmn!=""&&fmn!="undefined" && fmn!="请输入理财经理关键字")){
                                        	sou += "&fmName="+fmn;
                                        }
                                        
                                        if(startDate!=null && startDate !=""){
                                        	sou+="&startDate="+startDate;
                                        }
                                        if(endDate!=null && endDate !=""){
                                        	sou+="&endDate="+endDate;
                                        }
                                        
                                        if (sou!=""){
                                            location.href=url+sou;
                                        }
                                    }

                                    $("#searchName")[0].defaultValue=getQueryString("searchName","请输入(姓名 /身份证/手机)关键字");
                                    $("#fmName")[0].defaultValue=getQueryString("fmName","请输入理财经理关键字");
                            		function getQueryString(name,tip){
                            			var reg=new  RegExp("(^|&)"+name+"=([^&]*)(&|$)");
                            			var r =window.location.search.substr(1).match(reg);
                            			if(r!=null)
                            				return  decodeURI(r[2]);
                            			return  tip;
                            		}
                                </script>
                            </div>

            </td>
        </tr>
        <tr>
            <!--尾部--{-->
            <td colspan="3" class="mc-b"><#include "../foot.html"></td>
            <!--尾部--}-->
        </tr>
    </table>

    </body>
</html>
<script type="text/javascript">
$("#chk_all").click(function(){
    $("input[name='custIds']").attr("checked",$(this).attr("checked"));
});
$("#batchchange").click(function(){
	var flag = false; 
	
	$("input[name='custIds']:checked").each(function() {
		if($(this).attr("checked")){ 
			flag =true;
			return false
		}
	});
	
	if(flag){
		$("#custfmId").val($("#fmId").val());
		$("#batchForm").submit();
	}else{
		alert("请选择更改理财经理的客户!");
	}
    
});
</script>
<#include "../jsPage.html">
